package com.qianfeng.openapi.web.master.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.qianfeng.openapi.web.master.dto.TableData;
import com.qianfeng.openapi.web.master.dto.TableParam;
import com.qianfeng.openapi.web.master.entity.UserToken;
import com.qianfeng.openapi.web.master.service.UserTokenService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/12/30
 * @Time: 下午5:55
 */
@RestController
public class UserTokenController {

    @Resource
    private UserTokenService userTokenService;

    @RequestMapping("/userToken/list")
    public TableData tableData(TableParam p){
        return  userTokenService.findTokenByPage(p);
    }

    @RequestMapping("/userToken/save")
    public R add(@RequestBody UserToken token){
        return  userTokenService.save(token);
    }

    @RequestMapping("/userToken/update")
    public R update(@RequestBody  UserToken token){
        return  userTokenService.update(token);
    }

    //[11,22,33] json数组
    @RequestMapping(value = "/userToken/del")
    public  R deleteGateway(@RequestBody List<Integer> ids){
        return  userTokenService.deleteBatch(ids);
    }

    @RequestMapping("/userToken/info")
    public  R  apiMappingInfo(int id){

        return  userTokenService.findTokenById(id);
    }





}
